package com.ct.R.exception;

import com.ct.R.IResultCodeInterface;
import com.ct.R.Result.ResultEnum.ResultCodeEnum;
import lombok.Getter;

@Getter
public class ValidationException extends RuntimeException {
    private final Integer code;
    private final String codeDesc;
    private final String msg;


    public ValidationException(String codeDesc, String msg) {
        super(msg);
        this.codeDesc = codeDesc;
        this.msg = msg;
        this.code = ResultCodeEnum.SERVER_ERROR.getCode();
    }

    public ValidationException(IResultCodeInterface iResultCodeInterface) {
        super(iResultCodeInterface.getMsg());
        this.code = iResultCodeInterface.getCode();
        this.codeDesc = iResultCodeInterface.getCodeDesc();
        this.msg = iResultCodeInterface.getMsg();
    }
}
